﻿BoxSportSystem.materialesList = (function () {

    var viewModel = kendo.observable({
        materialesDataSource: {},
        criterio: "",
        buscar: function (e) {
            onShow();
        },
        materiales: {},
        selectMaterial: function (e) {
            this.set("materiales", e.data);
            console.log(e.data);
        }
    });

    function onShow() {
        var criterio = viewModel.get("criterio");

        $.ajax({
            url: BoxSportSystem.config.urlServiceMateriales + "?criterio=" + criterio,
            dataType: "json",
            success: function (data) {
                viewModel.set("materialesDataSource",data);
            }
        });
    }


    return {
        onShow: onShow,
        viewModel: viewModel
        
    };
})(window);